#ifndef _MAPPER2_H
#define _MAPPER2_H

#include "mapper.h"

class CMapper2 : public CMapper
{
public:
  CMapper2(CCpu* cpu) : CMapper(cpu)
  {
    Init();
  }

  virtual void Init()
  {
    m_Cpu->PrgRom[0] = ROM_BANK(0);
    m_Cpu->PrgRom[1] = ROM_BANK(1);
    m_Cpu->PrgRom[2] = ROM_BANK_L(1);
    m_Cpu->PrgRom[3] = ROM_BANK_L(0);
  }
  virtual void Write(u16 addr, u8 data)
  {
    data %= m_Cpu->m_ROMBankCount;
    data <<= 1;
    m_Cpu->PrgRom[0] = ROM_BANK(data);
    m_Cpu->PrgRom[1] = ROM_BANK(data + 1);
  }
};

#endif  // _MAPPER2_H
